﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;

namespace Commander.Views
{
    /// <summary>
    /// Логика взаимодействия для OpenDisk.xaml
    /// </summary>
    public partial class OpenDisk : Window
    {
        private string str;

        public OpenDisk()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DriveInfo[] allDrivers = DriveInfo.GetDrives();
            foreach (DriveInfo drv in allDrivers)
            {
                comboBox1.Items.Add(drv.Name);
            }
            comboBox1.SelectedIndex = 0;
        }

        public string Patch
        {
            set
            {
                str = value;
            }
            get
            {
                return str;
            }
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string tmp = comboBox1.SelectedItem.ToString();
            DriveInfo[] allDrivers = DriveInfo.GetDrives();
            foreach (DriveInfo drv in allDrivers)
            {
                if (drv.Name == tmp)
                {
                    if (drv.IsReady)
                    {
                        str = tmp;

                        this.Close();
                    }
                    else
                    {
                    }
                }
            }
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
